import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
//@ 表示 src 资源的根目录
import Product from "@/components/Product";
import Pets from "@/components/Pets";

Vue.use(Router)

export default new Router({
  //定义路由规则
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      //设参  来接受 route-link 中传过来的参数
      path: '/product/:id',
      name: 'Product',
      component: Product
    },
    {
      path: '/pets',
      name: 'Pets',
      component: Pets
    }
  ],
  //mode 修改路由规则，hash是路径带# 一般用于调试
  //mode:history 路径不带# 一般用于发布
  mode: "history"
})
